#ifndef SCENE_HEADER_VIZMF_PROJECT
#define SCENE_HEADER_VIZMF_PROJECT

#include <vector>
#include <string>
#include <algorithm>

#include "src/core/generic/vector3.h"
#include "src/gui/itemwidget.h"
#include "src/core/scene/light.h"
#include "src/core/scene/camera.h"
#include "src/core/scene/sceneparameters.h"
#include "src/core/scene/sceneelements.h"

class Scene : public ItemWidget
{
public:
  Scene()
  {
    params_.loadDefault();
  }

  const SceneParameters& parameters() const { return params_; }
  const SceneElements& elements() const { return elements_; }

  //  virtual void addLight(const Light& light) {}

  // to be reimpleented when lighting is clear
  //virtual void startList(Lists l) {}
  //virtual void endList() {}

  // some methods for selection mechanism
  //virtual void markBegin() {}
  //virtual void markEnd() {}

  virtual void drawSphere(const Vector3& center, const float radius, const Material& mat, const int detail = 5)
  {
    elements_.createSphere(center, radius, mat);
  }
  virtual void drawCylinder(const Vector3& from, const Vector3& to, const float radiusFrom, const float radiusTo, const Material& mat, const int detail = 5 )
  {
    elements_.createCylinder(from, to, radiusFrom, radiusTo, mat);
  }
  virtual void drawCone(const Vector3& from, const Vector3& to, const float radius, const Material& mat, const int detail = 5)
  {
    elements_.createCone(from, to, radius, mat);
  }
  virtual void drawParallelepiped(const Vector3& vertex, const Vector3& a, const Vector3& b, const Vector3& c, const Material& mat )
  {
    elements_.createParallelepiped(vertex, a, b, c, mat);
  }
  void setWidget(ItemWidget* widget_) { widget = widget_; }
  void update()
  {
    widget->startList(ItemWidget::Lit);
    int n = elements_.number3DElements();
    for(int i = 0; i < n; ++i)
    {
      elements_.get3DElem(i).drawMe(widget);
    }
    widget->endList();
  }

private:
  SceneElements elements_;
  SceneParameters params_;
  ItemWidget* widget;
};

#endif // SCENE_HEADER_VIZMF_PROJECT
